package com.android.nextBus.XML;

import java.util.List;

import org.apache.http.impl.client.DefaultHttpClient;

import com.android.nextBus.Data.BusStopData;

public class GetBusStopsXML {
// test crap...
	private static String URL_BASE = "http://10.0.2.2:8888";

	private static String REQUEST_BASE_FOR_SPECIFIC_QUERY = "/GetBusStopData?type=";

	private static String REQUEST_BASE = "/GetBusStopData";

	// THIS RETRIEVES THE HTTP CLIENT CONFIGURED ABOVE
	private static DefaultHttpClient httpClient = ConnectionManager.getClient();

	// HERE YOU PASS IN THE PLATFORM YOU WANT I.E. XBOX, PS3, ETC
	public static List<BusStopData> getBusStops(String platform) {
		// construct the URL
		String url = URL_BASE + REQUEST_BASE + platform;

		// get the XML response back as a String
		String response = GetMethods.doGetWithResponse(url, httpClient);

		// create a simple String parser TODO Parse using JSON instead!
		// here we want to convert XML to a list of BusStop objects
		List<BusStopData> games = ObjectParsers.parseGameResponse(response);
		return games;
	}

}
